package dahuiji.common.util;

import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.SimpleEmail;

public class SendMail {
	public SendMail() {
	}

	public void send(String smtp, String userEmail, String userEmailPassword,
			String to, String Subject, String Msg) {
		if(Constants.SEND_MAIL_OPOROFF){//默认关闭
			SimpleEmail email = new SimpleEmail();
			email.setTLS(true);
			email.setHostName(smtp);
			email.setAuthentication(userEmail, userEmailPassword);

			try {
				email.addTo(to);
				email.setFrom(userEmail); // 我方

				email.setSubject(Subject); // 标题

				email.setCharset("utf-8"); // 设置Charset

				email.setMsg(Msg);

				email.send();

			} catch (EmailException e) {
				e.printStackTrace();
			}
		}
		
	}

}
